package com.example.zwlyz;

import android.os.Bundle;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.example.zwlyz.models.Article;
import com.example.zwlyz.R;

public class ArticleDetailActivity extends AppCompatActivity {

    private TextView tvTitle;
    private TextView tvAuthor;
    private TextView tvTime;
    private TextView tvContent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_article_detail);

        tvTitle = findViewById(R.id.tvTitle);
        tvAuthor = findViewById(R.id.tvAuthor);
        tvTime = findViewById(R.id.tvTime);
        tvContent = findViewById(R.id.tvContent);

        // 从 Intent 获取文章数据
        Article article = (Article) getIntent().getSerializableExtra("article");
        if (article != null) {
            tvTitle.setText(article.getTitle());
            tvAuthor.setText(article.getAuthor());
            tvTime.setText(article.getTime());
            tvContent.setText(article.getContent());
        }
    }
}